<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	List tasklist = (List) request.getAttribute("task");
	Object[] taskRecord = (Object[]) tasklist.get(0);
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>My JSP 'readtask.jsp' starting page</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<link rel="stylesheet"
			href="<%=request.getContextPath()%>/css/common.css" type="text/css" />
		<script type='text/javascript'
			src='<%=request.getContextPath()%>/dwr/interface/systemUserGroupTaskAllocationAction.js'></script>
		<script type='text/javascript'
			src='<%=request.getContextPath()%>/dwr/engine.js'></script>
		<script type='text/javascript'
			src='<%=request.getContextPath()%>/dwr/util.js'></script>
		<script type="text/javascript">
		function changeStatus(){
			$("taskStatus").disabled = false ;
			$("btnSub").disabled = false ;
			
		}
		
		function sub(){
			if(!confirm('确定修改?')){
				return;
			}
			var status = $('taskStatus').options[ $('taskStatus').selectedIndex].value;
			var statusid = $('taskstatusid').value;
			systemUserGroupTaskAllocationAction.changeStatus(status, statusid,changeStatusCallback);
		}
		var changeStatusCallback = function changeStatusCallbackFunc(effectNum){
			if(effectNum == "出错了!!!!"){
				alert(effectNum);
			}
			else alert("修改成功，影响的行数为：" + effectNum);
		}
	</script>
	</head>

	<body>
		<div id="page_container">
			<div id="page_nav">
				<%@   include file="banner.jsp"%>
			</div>
			<table>
				<input type="hidden" name="taskstatusid" id="taskstatusid"
					value='<%=taskRecord[14]%>' />
				<tr>
					<td class="td_left">
						任务名称：
					</td>
					<td>
						<%=taskRecord[5]%>
					</td>
				</tr>
				<tr>
					<td class="td_left">
						发送者：
					</td>
					<td>
						<%=taskRecord[2]%>
					</td>
				</tr>
				<tr>
					<td class="td_left">
						发送时间：
					</td>
					<td>
						<%=taskRecord[4].toString().substring(0,19) %>
					</td>
				</tr>
				<tr>
					<td class="td_left">
						到期时间：
					</td>
					<td>
						<%=(null==taskRecord[7])?(""):(taskRecord[7].toString().substring(0,10))%>
					</td>
				</tr>
				<tr>
					<td class="td_left">
						内容：
					</td>
					<td>
						<%=taskRecord[6]%>
					</td>
				</tr>
				<tr>
					<td class="td_left">
						备注：
					</td>
					<td>
						<%=taskRecord[8]%>
						<br>
					</td>
				</tr>

				<tr>
					<td class="td_left">
						状态：
					</td>
					<td>
						<select class="common_select" id="taskStatus" name="systemuserstatus">
							<option value="已完成">
								已完成
							</option>
							<option value="未完成">
								未完成
							</option>

						</select>
					</td>
				</tr>
				<tr>
					<td>
					</td>
					<td>
						<input class="common_button"  type="button" value='修改状态' id="btnChangeStatus"
							onclick="changeStatus()" />
						<input class="common_button"  type="button" value='确认提交' id="btnSub" onclick="sub()"
							disabled="true" />
						<br>
					</td>
				</tr>

			</table>
		</div>
		<script type="text/javascript">
		if("<%=taskRecord[0]%>" == "未完成"){
			$("taskStatus").options[1].selected = "selected";
		}else{
			$("taskStatus").options[0].selected = "selected";
		}
		$("taskStatus").disabled = true ;
	</script>
	</body>
</html>

